package cn.edu.hqu.exp.courseselection;

import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

import cn.edu.hqu.exp.courseselection.domain.Course;
import cn.edu.hqu.exp.courseselection.domain.Course.Type;
import cn.edu.hqu.exp.courseselection.repository.CourseRepository;

@SpringBootApplication
public class CourseSelectionDatabaseApplication {

	public static void main(String[] args) {
		SpringApplication.run(CourseSelectionDatabaseApplication.class, args);
	}
	@Bean
	public CommandLineRunner dataLoader(CourseRepository repo) {
		return new CommandLineRunner() {

			@Override
			public void run(String... args) throws Exception {
				 repo.save(new Course("1","JavaWeb开发技术",Type.Election));
			     repo.save(new Course("2","数据挖掘",Type.Election));
			     repo.save(new Course("3","计算机网络",Type.Core));
			     repo.save(new Course("4","高等数学",Type.Basic));
			     repo.save(new Course("5","影视精品分析与创作",Type.GeneralEle));
			     repo.save(new Course("6","先秦诸子十五讲",Type.GeneralEle));
			     repo.save(new Course("7","植物的艺术",Type.GeneralEle));
			     repo.save(new Course("8","科幻小说阅读与赏析",Type.GeneralEle));
			     repo.save(new Course("9","算法设计与分析",Type.Election));
			     repo.save(new Course("10","数据挖掘",Type.Election));
			     repo.save(new Course("11","软件工程",Type.Core));
			     repo.save(new Course("12","计算机操作系统",Type.Core));
			     repo.save(new Course("13","计算机组成原理",Type.Core));
			     repo.save(new Course("14","大学物理",Type.Basic));
			     repo.save(new Course("15","离散数学",Type.Basic));
			     repo.save(new Course("16","高等代数",Type.Basic));
			     repo.save(new Course("17","毛泽东思想与中国特色社会主义理论",Type.GeneralEdu));
			     repo.save(new Course("18","马克思主义基本原理概论",Type.GeneralEdu));
			     repo.save(new Course("19","职业生涯规划",Type.GeneralEdu));
			     repo.save(new Course("20","形势与政策",Type.GeneralEdu));
			}
		
		};
	}
}
